package com.huoyun.car.service;

import java.util.List;

import com.huoyun.car.bean.Car;
import com.huoyun.car.dao.CarDao;
import com.huoyun.car.model.CarDriverOwnerModel;
import com.huoyun.car.model.CarModel;
import com.huoyun.car.model.CarUserCompanyModel;
import com.huoyun.car.service.evt.QueryCarEvt;

public class CarServiceImpl implements CarService{
	CarDao carDao;
	
	public CarDao getCarDao() {
		return carDao;
	}

	public void setCarDao(CarDao carDao) {
		this.carDao = carDao;
	}

	public void saveCar(Car car) {
		// TODO Auto-generated method stub
		carDao.saveCar(car);
	}

	@Override
	public List<Car> getCarList(long userId) {
		return carDao.getCarListByUserId(userId);
	}

	@Override
	public Car getCarById(long carId) {
		// TODO Auto-generated method stub
		return carDao.getCarById(carId);
	}

	@Override
	public String getDefaultContactByPlateNumber(String pNumber) {
		// TODO Auto-generated method stub
		
		return null;
	}
	
	public void updateAll(Car car) {
		carDao.updateAll(car);
	}
	
	public List<Car> getUnPublishedCarListByUserId(long userId) {
		return carDao.getUnPublishedCarListByUserId(userId);
	}

//	@Override
//	public List<Car> getCarListByLoadMaxForUser(long userId, String loadMax) {
//		// TODO Auto-generated method stub
//		return carDao.getCarListByLoadMaxForUser(userId, loadMax);
//	}

	@Override
	public List<Car> getCarListByUsername(String username) {
		// TODO Auto-generated method stub
		return carDao.getCarListByUsername(username);
	}

	@Override
	public void delete(long carId) {
		// TODO Auto-generated method stub
		carDao.delete(carId);
	}

	@Override
	public String getDriverTelephoneByDriverId(long driverId) {
		// TODO Auto-generated method stub
		return carDao.getDriverTelephoneByDriverId(driverId);
	}
	
	@Override
	public List<Car> getCarListForCargoByAmount(long userId, String amount, long goodsId) {
		// TODO Auto-generated method stub
		return carDao.getCarListForCargoByAmount(userId, amount, goodsId);
	}

	@Override
	public CarDriverOwnerModel getCarDriverOwnerModelByCarId(long id) {
	
		return carDao.getCarDriverOwnerModelByCarId(id);
	}

	@Override
	public Car getCarByCarNumber(String carNumber) {
		
		return this.carDao.getCarByCarNumber(carNumber);
	}

	@Override
	public long queryCarCount(QueryCarEvt queryCarEvt) {
		com.huoyun.car.dao.evt.QueryCarEvt evt = new com.huoyun.car.dao.evt.QueryCarEvt();
		evt.setAddTime(queryCarEvt.getAddTime());
		return carDao.queryCarCount(evt);
	}

	@Override
	public List<CarModel> getCarModelListByUserId(long userId) {
		// TODO Auto-generated method stub
		return carDao.getCarModelListByUserId(userId);
	}

	@Override
	public List<CarUserCompanyModel> getLatestNCar(long topN) {
		// TODO Auto-generated method stub
		return carDao.getLatestNCar(topN);
	}

}
